//
//  MemberWelfareSecondLastTableViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/30.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "MemberWelfareSecondLastTableViewCell.h"

@interface MemberWelfareSecondLastTableViewCell ()

@property (strong, nonatomic) UILabel *titleL;
// 标题下内容的北京
@property (strong, nonatomic) UIImageView *cellBG;
// 小图标
@property (strong, nonatomic) UIImageView *smallIV;

@property (strong, nonatomic) UILabel *desL1;
@property (strong, nonatomic) UILabel *desL2;

@end

@implementation MemberWelfareSecondLastTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView addSubview:self.titleL];
        [self.contentView addSubview:self.cellBG];
        [self.contentView addSubview:self.smallIV];
        [self.contentView addSubview:self.desL1];
        [self.contentView addSubview:self.desL2];
        
    }
    
    return self;
}

- (void)setOneModel:(MemberVModel *)oneModel {
    
    self.titleL.text = oneModel.title;
    [self.smallIV sd_setImageWithURL:[NSURL URLWithString:oneModel.photo]];
    self.desL1.text = oneModel.stitle;
    self.desL2.text = oneModel.doc;
}

- (void)setDict:(NSDictionary *)dict {
    
//    _dict = dict;
    
    self.titleL.text = dict[@"title"];
    self.smallIV.image = dict[@"icon"];
    self.desL1.text = dict[@"desl1"];
    self.desL2.text = dict[@"desl2"];
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(40));
        make.top.mas_equalTo(weakSelf.contentView.mas_top).with.offset(jisuan(40));
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(40));
        make.height.mas_equalTo(jisuan(44));
    }];
    [self.cellBG mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom);
        make.height.mas_equalTo(jisuan(168));
        make.width.mas_equalTo(jisuan(670));
    }];
    [self.smallIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.cellBG.mas_left);
        make.right.mas_equalTo(weakSelf.cellBG.mas_right);
        make.top.mas_equalTo(weakSelf.cellBG.mas_top);
        make.bottom.mas_equalTo(weakSelf.cellBG.mas_bottom);
        
    }];
    [self.desL1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(weakSelf.cellBG.mas_centerX);
        make.top.mas_equalTo(weakSelf.cellBG.mas_top).with.offset(jisuan(50));
        
    }];
    [self.desL2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(weakSelf.cellBG.mas_centerX);
        make.bottom.mas_equalTo(weakSelf.cellBG.mas_bottom).with.offset(-jisuan(40));
        
    }];
    
}

#pragma mark -lazy

- (UILabel *)titleL {
    
    if (!_titleL) {
        
        _titleL = [[UILabel alloc] init];
        _titleL.textColor = Color333333;
        //        _titleL.font = Font(32);
        _titleL.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:jisuan(32)];
        _titleL.textAlignment = NSTextAlignmentLeft;
        
    }
    
    return _titleL;
}

- (UIImageView *)cellBG {
    
    if (!_cellBG) {
        
        _cellBG = [[UIImageView alloc] init];
        _cellBG.contentMode = UIViewContentModeScaleAspectFit;
        _cellBG.image = [UIImage imageNamed:@"memberWelfareInterestBG"];
        
    }
    
    return _cellBG;
}
- (UIImageView *)smallIV {
    
    if (!_smallIV) {
        
        _smallIV = [[UIImageView alloc] init];
        _smallIV.contentMode = UIViewContentModeScaleAspectFit;
    }
    
    return _smallIV;
}

- (UILabel *)desL1 {
    
    if (!_desL1) {
        
        _desL1 = [[UILabel alloc] init];
        _desL1.textColor = Color333333;
        //        _desL1.font = Font(32);
        _desL1.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:jisuan(28)];
        _desL1.textAlignment = NSTextAlignmentCenter;
        
    }
    
    return _desL1;
    
}
- (UILabel *)desL2 {
    
    if (!_desL2) {
        
        _desL2 = [[UILabel alloc] init];
        _desL2.textColor = Color999999;
        _desL2.font = Font(20);
        _desL2.textAlignment = NSTextAlignmentCenter;
        
    }
    
    return _desL2;
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
